package cn.hdc.os.biz.impl;

import cn.hdc.os.biz.DepartmentBiz;
import cn.hdc.os.dao.DepartmentDao;
import cn.hdc.os.entity.Department;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("departmentBiz")
//部门管理业务层，调用持久层
public class DepartmentBizImpl implements DepartmentBiz {
    @Qualifier("departmentDao")
    @Autowired
    private DepartmentDao departmentDao;

    //新增部门
    @Override
    public void add(Department department) {
        departmentDao.insert(department);
    }

    //修改部门
    @Override
    public void edit(Department department) {
        departmentDao.update(department);
    }

    //删除部门
    @Override
    public void remove(String sn) {
        departmentDao.delete(sn);
    }

    //根据sn查找部门
    @Override
    public Department get(String sn) {
        return departmentDao.select(sn);
    }

    //查找所有部门
    @Override
    public List<Department> getAll() {
        return departmentDao.selectAll();
    }
}
